home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / contrib / dvx / docs / dvapi.doc < prev    next >
Encoding:
Text File  |  1993-07-15  |  14.7 KB  |  575 lines

  1.  
  2. DESQview/X Systewm Library Programming Reference
  3. ------------------------------------------------
  4. The following functions are system-level calls that compose the 
  5. non-BSD portion of the DESQview/X System Library. 
  6.  
  7. General Functions: 
  8.   dvpath           - get the directory into which DESQview/X has 
  9.                      been installed. 
  10.   CanonicalPath       - calls DOS int 21 function 60h.
  11.   pmiSegAbsolute   - return a DOS extender independent first meg 
  12.                      address. 
  13.   pmiSegCancel     - cancel a protected mode selector. 
  14.   apiBeginC        - begin critical region.
  15.   apiEndC          - end critical region.
  16.   apiIsObj         - determine if a given handle is valid.
  17.   apiPause         - give other tasks a chance to run.
  18.  
  19. Application Management Functions: 
  20.   NewProc          - start a new process .
  21.   pif_open         - open a program information file, using the 
  22.                      dvp search path. 
  23.   pif_start        - starts a process, using a filename as 
  24.                      argument.
  25.  
  26. Window Management Functions:
  27.   winMe            - get the current tasks window handle.
  28.   winStream        - write a stream to a window.
  29.  
  30. Mailbox Management Functions: 
  31.   malFind          - find a mailbox by name.
  32.   malName          - assign a global name to a mailbox..
  33.   malSizeOf        - get number of messages pending. 
  34.   malAddTo         - send a message by value with given status. 
  35.   malFree          - free a mailbox object. 
  36.   malNew           - create a new mailbox. 
  37.   malOpen          - open a mailbox.
  38.   malNRead         - read a mailbox.
  39.  
  40. Object Management Functions: 
  41.   obqClose         - close a tasks objectq .
  42.   obqOpen          - open the tasks objectq. 
  43.   obqSizeOf        - get number of objectq entries pending. 
  44.   obqRead          - wait for any object to have input.
  45.  
  46. Timer Management Functions: 
  47.   timAddTo         - start a timer for a given interval. 
  48.   timFree          - free a timer object. 
  49.   timNew           - create a timer object.
  50.  
  51.  
  52. General Functions 
  53. -----------------
  54.  
  55.  
  56. dvpath() - get the directory into which DESQview/X has been 
  57.            installed. 
  58.  
  59. SYNOPSIS 
  60. --------
  61. #include <qdeck.h> 
  62. void dvpath(char *dvxdir); 
  63.  
  64. DESCRIPTION 
  65. -----------
  66. Returns the directory into which DESQview/X has been installed.
  67. dvxdir must be pre-allocated before dvpath is called.
  68.  
  69.  
  70. Canonical Path() - returns a canonical path
  71.  
  72. SYNOPSIS 
  73. --------
  74. #include <qdeck.h>
  75.  
  76. int CanonicalPath(char *inpath, char *outpath);
  77.  
  78. DESCRIPTION 
  79. -----------
  80. Calls DOS interrupt 21 function 60h to return a canonical path.
  81.  
  82.  
  83. pmiSegAbsolute() - return a DOS extender independent real mode 
  84.                    address  
  85.  
  86. SYNOPSIS 
  87. --------
  88. #include <pmi.h> 
  89.  
  90. char *pmiSegAbsolute(unsigned short seg, unsigned short offset, 
  91.                     unsigned short len);
  92.  
  93. DESCRIPTION 
  94. -----------
  95. This function returns a DOS extender independent real-mode 
  96. address. 
  97.  
  98. For a 16-bit protected mode program this function creates a 
  99. protected mode selector, with the segment limit set to 'len' 
  100. bytes; a size of 0 represents 64K. 
  101.  
  102. For a 32-bit protected mode program this function maps an address 
  103. to the first Megabyte selector.
  104.  
  105. This function is necessary when copying data from protected mode 
  106. to real mode. It should be used in conjunction with 
  107. pmiSegCancel();
  108.  
  109.  
  110. pmiSegCancel() - cancel a protected mode selector
  111.  
  112. SYNOPSIS 
  113. --------
  114. #include <pmi.h> 
  115.  
  116. void pmiSegCancel(void farptr);
  117.  
  118. DESCRIPTION 
  119. -----------
  120. This function cancels a protected mode pointer.The memory is not 
  121. freed or released; the selector is merely made invalid.
  122.  
  123.  
  124. apiBeginC() - begin critical region
  125.  
  126. SYNOPSIS 
  127. --------
  128. #include <dvapie.h>
  129.  
  130. void apiBeginC(void);
  131.  
  132. DESCRIPTION 
  133. -----------
  134. The apiBeginC function causes the current task to enter a 
  135. critical region during which all multitasking is suspended. The 
  136. calling task is allowed to continue execution until it calls 
  137. apiEndc or voluntarily gives up control. If it voluntarily gives 
  138. up control (by waiting for keyboard input for instance) 
  139. multitasking is allowed to resume until the task regains control, 
  140. at which time multitasking is again suspended. This facility can 
  141. be useful for executing time critical sections of code and for 
  142. controlling access to common resources. It should be used 
  143. sparingly to avoid degrading overall system performance. 
  144.  
  145. If another task is using DOS when the apiBeginC call is made, the 
  146. caller will be suspended until DOS is free. This means that you 
  147. are free to call DOS from inside a critical region.
  148.  
  149.  
  150. apiEndC() - end critical region
  151.  
  152. SYNOPSIS 
  153. --------
  154. #include <dvapie.h>
  155.  
  156. void apiEndC(void);
  157.  
  158. DESCRIPTION 
  159. -----------
  160. The apiEndC function defines the end of a critical region of 
  161. code. Critical regions are entered via the apiBeginC function. 
  162. Calls to apiBeginC and apiEndC may be nested. Multitasking does 
  163. not resume until an apiEndC call has been executed for every 
  164. apiBeginC call that has been made.
  165.  
  166.  
  167. apiIsObj() - determine if a given handle is valid
  168.  
  169. SYNOPSIS 
  170. --------
  171. #include <dvapie.h> 
  172.  
  173. int apiIsObj(objhan); 
  174.  
  175. DESCRIPTION 
  176. -----------
  177. The apilsObj function returns 1 if the value specified is the 
  178. handle of a currently valid object. Otherwise, it returns 0. It 
  179. is generally better to keep track of your own objects rather than 
  180. depend on this call. It can help, however, in error paths where 
  181. bookkeeping can be difficult.
  182.  
  183.  
  184. apiPause() - give other tasks a chance to run
  185.  
  186. SYNOPSIS 
  187. --------
  188. #include <dvapie.h>
  189.  
  190. void apiPause(void);
  191.  
  192. DESCRIPTION 
  193. -----------
  194. The apiPause 
  195. function gives up control to the dispatcher so that other tasks can 
  196. be run. The calling task will regain control when its normal turn 
  197. occurs. Applications should make this call within all busy-wait loops, 
  198. that is, loops that are doing nothing useful but looking for something 
  199. to do.
  200.  
  201.  
  202. Application Management Functions
  203. ---------------------------------
  204.  
  205. NewProc() - start a new process
  206.  
  207. SYNOPSIS 
  208. --------
  209. #include <qdeck.h> 
  210.  
  211. unsigned long NewProc(char *dvpbuf,int len);
  212.  
  213. DESCRIPTION 
  214. -----------
  215. Creates a new DESQview/X process. dvpbuf is a dvp either previous 
  216. read from disk or one created in memory. len is the length of the 
  217. dvp being passed in dvpbuf.
  218.  
  219. Allows a task to start a new process, just as if the user had 
  220. selected it from the window manager menu. dvpbuf is a dvp either 
  221. previously read from disk or one created in memory. len is the 
  222. length of the dvp being passed in dvpbuf.
  223.  
  224.  
  225. Return Value
  226. ------------
  227. NewProc() returns the handle of the new process' initial task to 
  228. the caller.
  229.  
  230.  
  231. pif_open() - open a program information file, using the dvp 
  232.              search path.
  233.  
  234. SYNOPSIS 
  235. --------
  236. #include <qdeck.h> 
  237.  
  238. FILE *pif_open(char *pifname, char **pathname);
  239.  
  240. DESCRIPTION 
  241. -----------
  242. Opens a dvp program information file, given a pathname. You may 
  243. want to use pif_open in conjunction with fread() and NewProc() if 
  244. adjustments need to be made to the dvp before it is started. 
  245.  
  246.  
  247. Return Value
  248. ------------
  249. Returns a file handle on success or NULL on failure.
  250.  
  251.  
  252. pif_start() - starts a process, using a filename as argument.
  253.  
  254. SYNOPSIS 
  255. --------
  256. #include <qdeck.h> 
  257.  
  258. int pif_start(char *args);
  259.  
  260. DESCRIPTION 
  261. -----------
  262. Starts a process, using a filename as argument. The first word of 
  263. args must be a file name. If no extension is present a .dvp will 
  264. be added. If no path is present the file will be looked for in 
  265. current directory then in the path. 
  266.  
  267. Return Value
  268. ------------
  269. Returns 0 on success, ENOENT if the file specified by args is not 
  270. found, EBADF if the file specified by args is invalid, E2BIG if 
  271. the dvp if the file specified by args is an invalid 
  272. length and ENOEXEC if the new process cannot be started.
  273.  
  274.  
  275. Window Management Functions
  276. ---------------------------
  277.  
  278. winMe() - get the current tasks window handle
  279.  
  280. SYNOPSIS 
  281. --------
  282. #include <dvapie.h> 
  283.  
  284. unsigned long winMe(void);
  285.  
  286. DESCRIPTION 
  287. -----------
  288. The winMe function returns the handle of the current task's 
  289. window.
  290.  
  291.  
  292. winStream() - write a stream to a window
  293.  
  294. SYNOPSIS 
  295. --------
  296. #include <dvapie.h> 
  297.  
  298. unsigned long winStream(unsigned long winhan, char * stream);
  299.  
  300.  
  301. DESCRIPTION 
  302. -----------
  303. The winStream function sends a data stream to a window. Returns a 
  304. new window handle or 0, given a window handle and a pointer to a 
  305. stream to be written. winStream cannot be used to define a field 
  306. table entry
  307.  
  308.  
  309. Mailbox Management Functions 
  310. ----------------------------
  311. malFind - find a mailbox by name
  312.  
  313.  
  314. SYNOPSIS 
  315. --------
  316. #include <dvapie.h>
  317.  
  318. unsigned long malfind (char *name, int lname);
  319. /* char *name; pointer to name string */
  320. /* int  lname; length of name string */
  321.  
  322. DESCRIPTION
  323. -----------
  324. The malFind function searches for a mailbox with the given name 
  325. and returns its handle, or zero if no mailbox has that name. 
  326.  
  327.  
  328. malName() - assign a global name to a mailbox
  329.  
  330. SYNOPSIS 
  331. --------
  332. #include <dvapie.h> 
  333.  
  334. void malName (unsigned long malhan,char *name,int lname); 
  335. /* unsigned long    malhan;  mailbox handle */ 
  336. /* char     *name; pointer to name string */ 
  337. /* int       lname;  length of name string */
  338.  
  339. DESCRIPTION 
  340. -----------
  341. The malName function assigns a name to a mailbox. Once a mailbox 
  342. has been named, other tasks can determine its handle by calling 
  343. the malFind function.
  344.  
  345.  
  346. malSizeOf() - get number of messages pending
  347.  
  348. SYNOPSIS 
  349. --------
  350. #include <dvapie.h>
  351.  
  352. int malSizeOf (unsigned long malhan);    
  353. /* mailbox handle */
  354.  
  355. DESCRIPTION 
  356. -----------
  357. Returns the number of messages currently queued to the mailbox.
  358.  
  359. malAddTo() - send a message with given status
  360.  
  361. SYNOPSIS 
  362. --------
  363. #include <dvapie.h> 
  364.  
  365. int malAddto (unsigned long malhan,char *buffer, int buflen, 
  366.               int status, int append); 
  367. /* unsigned long malhan;     mailbox handle */ 
  368. /* char *buffer;         pointer to message */
  369. /* int buflen;         length of message */
  370. /* int status;         status of message */
  371. /* int apend;         whether to append messages or not */
  372.  
  373. DESCRIPTION 
  374. -----------
  375. The malAddto function sends a message by value and explicitly 
  376. sets the message status. If append is TRUE, messages of the 
  377. same status can be appended and read as a stream. The status value 
  378. is supplied by the sender and is an arbitrary value in the range 0 
  379. to 255.
  380.  
  381. Return Value
  382. ------------
  383. Returns zero on success or non-zero on failure.
  384.  
  385.  
  386. malFree() - free a mailbox object
  387.  
  388. SYNOPSIS 
  389. --------
  390. #include <dvapie.h> 
  391.  
  392. void malFree (unsigned long malhan); 
  393. /* unsigned long    malhan;    mailbox handle */
  394.  
  395. DESCRIPTION 
  396. -----------
  397. The malFree function frees all memory associated with the mailbox 
  398. including any messages still queued to the mailbox.
  399.  
  400.  
  401. malNew() - create a new mailbox
  402.  
  403. SYNOPSIS 
  404. --------
  405. #include <dvapie.h> 
  406.  
  407. int  malNew (unsigned long malhan);
  408. /* unsigned long    malhan;    mailbox handle */
  409.  
  410. DESCRIPTION 
  411. -----------
  412. The malNew function creates a new mailbox object and returns its 
  413. handle.
  414.  
  415. malOpen() - open a mailbox
  416.  
  417. SYNOPSIS 
  418. --------
  419. #include <dvapie.h> 
  420.  
  421. void malOpen(unsigned long malhan);
  422. /* unsigned long    malhan;    mailbox handle */
  423.  
  424. DESCRIPTION 
  425. -----------
  426. The malOpen function opens a mailbox for input. It establishes 
  427. the calling task as the owner of the mailbox and, therefore, as 
  428. the only task allowed to read the mailbox. You must open a 
  429. mailbox that you have created before any task can send messages 
  430. to it.  Your task mailbox is opened automatically for you by 
  431. DESQview/X. 
  432.  
  433.  
  434. malNRead() - read a mailbox
  435.  
  436. SYNOPSIS 
  437. --------
  438. #include <dvapie.h>
  439.  
  440. int malNRead(unsigned long malhan, car *name, int *len,
  441.              int *stat);
  442. /* unsigned long malhan;   mailbox handle */
  443. /* char *name;               pointer to mailbox name string*/
  444. /* int *len;      returns: pointer to length of message */
  445. /* int *stat;     returns: pointer to status value to associate 
  446.                            with message */
  447.  
  448. DESCRIPTION 
  449. -----------
  450. The malNRead function returns the next message queued to the 
  451. specified mailbox and its status. The length of the message is 
  452. passed to the function with the requested length and returns the 
  453. actual length read. When you read a mailbox that is not already 
  454. open DESQview/X will open it for you.
  455.  
  456. Return Value
  457. ------------
  458. Returns zero on success and non-zero on failure.
  459.  
  460.  
  461. Object Management Functions
  462. ---------------------------
  463.  
  464.  
  465. obqClose() - close a tasks objectq
  466.  
  467. SYNOPSIS 
  468. --------
  469. #include <dvapie.h> 
  470.  
  471. unsigned long obqClose(void);
  472.  
  473. DESCRIPTION 
  474. -----------
  475. The obqClose function discards all objects from the task's 
  476. objectq and prevents any further objects from being added. Each 
  477. object in the objectq is erased to insure that its data is also 
  478. discarded. The objects remain open.
  479.  
  480.  
  481. obqOpen() - open the tasks objectq
  482.  
  483. SYNOPSIS 
  484. --------
  485. #include <dvapie.h> 
  486.  
  487. void obqOpen(void);
  488.  
  489. DESCRIPTION 
  490. -----------
  491. The obqOpen function opens the task's objectq for use.
  492.  
  493.  
  494. obqSizeOf() - get number of objectq entries pending
  495.  
  496. SYNOPSIS 
  497. --------
  498. #include <dvapie.h> 
  499. int  obqSizeOf (void);
  500.  
  501. DESCRIPTION 
  502. -----------
  503. The obqSizeof function returns the number of objects in the 
  504. calling task's objectq.
  505.  
  506.  
  507. obqRead() - wait for any object to have input
  508.  
  509. SYNOPSIS 
  510. --------
  511. #include <dvapie.h> 
  512.  
  513. unsigned long obqRead (void);
  514.  
  515. DESCRIPTION 
  516. -----------
  517. The obqRead function returns the object handle of the next object 
  518. in the objectq. ObqRead of an empty objectq suspends the calling 
  519. task until an object is added to the queue. The obqRead function 
  520. automatically opens the objectq if it was not previously open.  
  521.  
  522.  
  523. Timer Management Functions
  524. --------------------------
  525.  
  526.  
  527. timAddTo() - start a timer for a given interval
  528.  
  529. SYNOPSIS 
  530. --------
  531. #include <dvapie.h> 
  532.  
  533. void timAddto (unsigned long timhan,unsigned long interval); 
  534. /* unsigned long    timhan;     timer handle */ 
  535. /* unsigned long    interval;  # 1/100ths of a second in the 
  536.                         time interval */
  537.  
  538. DESCRIPTION 
  539. -----------
  540. The timAddto function starts a timer running that will 
  541. expire after a specified time interval. The duration of the timer 
  542. is defined by a 32-bit number that represents the number of 1/100ths 
  543. of a second in the interval. The timer is automatically opened if 
  544. necessary.
  545.  
  546.  
  547. timFree() - free a timer object
  548.  
  549. SYNOPSIS 
  550. --------
  551. #include <dvapie.h> 
  552.  
  553. void timFree (unsigned long timhan); 
  554. /* unsigned long    timhan;     timer handle */
  555.  
  556. DESCRIPTION
  557. -----------
  558. The timFree function closes a timer if it is still open and frees 
  559. the memory associated with the timer object.
  560.  
  561.  
  562. timNew() - create a timer object
  563.  
  564. SYNOPSIS 
  565. --------
  566. #include <dvapie.h> 
  567.  
  568. unsigned long timNew (unsigned long *timer);
  569.  
  570. DESCRIPTION 
  571. -----------
  572. The timNew function creates a new timer object and returns its 
  573. handle.
  574.  
  575.